{__NOLAYOUT__}
<layout name="no_nav" />

<style type="text/css">
.selected-item {
	border: 2px solid #bb8866;
	border-radius: .2em;
}
.lists-item:last-child {
	border-bottom: auto;
}
</style>

<!-- TOPBAR -->
<header class="top-bar flex-row">
  <a class="row-item row-item-auto top-bar-back" href="javascript:window.history.back()">返回</a>
  <h3 class="row-item top-bar-name"></h3>
  <span class="row-item row-item-auto top-bar-menu"></span>
</header>

<eq name="Think.get.mode" value="edt">

<section class="order-list">
  <div class="lists">
    <volist name="bankLists" id="vo">
    <a class="lists-item lists-item-link <eq name='vo.isDefault' value='1'>selected-item</eq>" href="javascript:;" bank-id="{$vo['id']}">
      <h5 class="order-list-title ellipsis">{$vo['bankName']}</h5>
      <p>开户人姓名：{$vo.accountName}</p>
      <p>银行卡号：{$vo.account}</p>
    </a>
    </volist>  
  </div>
</section>
<section class="lists">
  <div class="lists-item">
    <a class="lists-item-link" href="__CONTROLLER__/addBank/sid/{$sid}?back={$backUrl}">添加新银行卡</a>
  </div>
</section>
<script>
	var sid = {$sid};
	(function() {
		$(".lists-item").click(function() {
			window.location = "__CONTROLLER__/modifyBank/sid/{$sid}?id="+$(this).attr('bank-id')+"&back={$backUrl}";
		});
	})();
</script>

<else/>

<section class="order-list">
  <div class="lists">
    <volist name="bankLists" id="vo">
    <a class="lists-item lists-item-link <eq name='vo.isDefault' value='1'>selected-item</eq>" href="javascript:;" bank-id="{$vo['id']}">
      <h5 class="order-list-title ellipsis">{$vo['bankName']}</h5>
      <p>开户人姓名：{$vo.accountName}</p>
      <p>银行卡号：{$vo.account}</p>
    </a>
    </volist>  
  </div>
</section>
<section class="lists">
  <div class="lists-item">
    <a class="lists-item-link" href="__CONTROLLER__/addBank/sid/{$sid}?back={$backUrl}">添加新银行卡</a>
  </div>
</section>
<script>
	var sid = {$sid};
	(function() {
		$(".lists-item").click(function() {
			$.post("__CONTROLLER__/setDefaultBank", {'bankId':$(this).attr('bank-id'), 'sid':sid}, function(data) {
				if (data.error == 0 ) {
					window.location = "{$backUrl}"==''?document.referrer:"{$backUrl}";
				} else {
					APP.alert(data.msg);
				}
			});
		});
	})();
</script>

</eq>